package com.config;

import java.io.FileWriter;
import java.io.IOException;

public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2021000121629464";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCFlsr0fJDywT2E2H//dHzhxji00dg+MgTdqUergZyn1eaoR/4npnVR/KnNSrtS9ly4loBFYK16wgJUeIClH24DbR62lBvu4BdmlKB8mUeLsdP0OYn9+07tl6QDjUBqdZ4pfzD1LxlVLsXzhehe6M5SdI6CxzdJRgjkhHa5+xIqr2w4I2tC8mevcN7YPQCzY27n4867EduJ+HtOgdFtjlvXU28TaLQVucMUB0hmiy7bwUVW5Lb2VUYRaP+cVNwdmFH5o2vGqA2sdRKX1MLHeTdSAe1AtGkK2M5p21EJSJ6BfyhscOEjNVgfOXSypcjFAdtFsx3oEe91h2G47PDg5LnvAgMBAAECggEAPOoxyaIzhj5PixAd7aJ0f48ftHQrotC0H09devszL+T9tKZ/Yh0pSiVoWFBHcuEcDp+yBfC7qkplPZdlMeZPCAjuBFstEZPll8UWGTrbwPtppufF4KaDqxuGkogKY4EWid2RuXuslYcqhIz/FKgbzMWRZljpAOSKkYlFijDOa9/BJvNnQI6caDkkEyDHLQYR7Yons+ygO4v1zwwxDsK27IDHEPTfNLHkCW6U1bMMPQ/b1J7BJElg8Oul7haFwcQS2w8nnIQ9gW0rNaATFRx7TXVvsEpTjRXreTI9Y3ds4dKK5f7qFodsiu0kQQsdO95K7ErZjgbMcqnfMNbfev5wgQKBgQDBw6XdYQUaSw36UTCQ7tpPS4csXond07OBs8EbMlrmeetrUPQvbq70eK04FowoubXjzyPviP/TzMAkcPXzqvNTc88NcrnG30TaZVfFihbivNPUKvxlu8G+tk8HaucjfxVjn+AuYCQTCb5PHMRpvsdgphkTRAB9pv2bcIoU+kYJEQKBgQCwfzX9Acc5hychamUhjsMKrX56bIfRgfGhAGcAxLYz0i/SifxP8DC7qeRxqMerBOrscJn5mbh/k/IXkLDfiUdOXpy7blEU9vhCCrY1A68mnZpnBlm2+D90uX7eE/CbGxboZYvvQ1iENzfsnfAwVCcp1jTN8ted7bwG0PyBFJaS/wKBgADxcdo9AahaGyxPvtvFvdxK8tJ9d1BUGniUJml6ekTK7SFtmHKuqD1aZQVz3qTIGqGMPZGJ6izev0SuJBRWja6nTqezGkJkjdI+UgoNHQVng+RxfR8FpfDGtGXF2HAsyy7b9VxkbWiGUJ3T9wTIv/GxfUfBufrimDNsfc+SVErxAoGAYskApbh+EnPT8f8D1ZF7FxneBZWDOz8Yx71a6XIwbLbC73stzmwoSpEffII0J0NcXbP0amCghD+BK7FfXe4PDA0mej2Xgj1s3EH0k52ZRerGRc2nHyK5GZLNMG1GqPmzi6VyehteiroBQh1wFwyy0tbCvVajWhB6wfHssi6czG8CgYBXX+dnsi91z4siXPW98zLjTmTP3W1h14cX831YXZSCaaCIN6KgCOZncoQe0h2oIRPBsnKXQhXLQ5u8cBQwMbAdE68YErST/wn286sgYFbyIc5B/wMWR6u2JuPpb/Wx3h5A6DfkooSzSndVwvIIVzRPnCcJtC0xujynDAiVzG/y2w==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnFDtREhSHMNFntNRPGd5m4EebSYPWoYidDYHTYyCGIIFnzRJEklOAoP+E9W84QUgCzhqcIRVG+rVFhP3KI7IaXRChnOy2RfIL8Vsc09/pV0toub6Jy150Kbse8lTRSpquTTuk/GjD2J5m8I6aKghforDtxLV2OBnM0qanJ3DCHdOLber6i68Me1QLFsdN8JoDNTKlQ68lMbTVhqWOY3pY8isMJeCZhrdL/3sWk/MqPK1k0jFnMWW+ORvyX3DliK0r+jUxuFWKIutx34eYXTnS3FNcLTewhnthB95cUmGu+vBbVuklFNHInOuFoOimudiidfhGExxYa/zevYmLvcknQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/#/Hello/Records";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://localhost:8080/#/Hello/Records";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

